VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CMesa"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'---------------------------------------------------------------------------------------
' Module    : CMesa
' DateTime  : 30/11/2011 12:08
' Author    :
' Purpose   : Clase Control Mesa
'---------------------------------------------------------------------------------------
Option Explicit
Private logica As lPedido
Private lmesa As lmesa
Private lPedido As lPedido
Private lSalon As lSalon

Public Sub cambiarMesa(bMesaOrigen As bMesa, bMesaDestino As bMesa)
    Dim bpedido As bpedido
    Set bpedido = logica.getPedidoPorMesa(bMesaOrigen)
    If bpedido Is Nothing Then
        utilMensaje.muestraMensaje errorEncontrado
        Exit Sub
    End If
    Set bpedido.bMesa = bMesaDestino
    lmesa.setOcupada bMesaDestino
    lmesa.setLibre bMesaOrigen
    logica.guardar bpedido
    Set frmTablero.lista = lSalon.getListaMesas(frmTablero.bSalon)
End Sub
Public Sub liberarMesa(bMesa As bMesa)
    Dim bpedido As bpedido
    Dim result As Integer
    Set bpedido = logica.getPedidoPorMesa(bMesa)
    If bpedido Is Nothing Then
        utilMensaje.muestraMensaje errorEncontrado
        Exit Sub
    End If
    result = lPedido.eliminarPedido(bpedido)
    If result = UtilConstantes.OPT_PEDIDO_NO_ELIMINABLE Then
        utilMensaje.muestraMensaje PedidoNoEliminable
        Exit Sub
    End If
    lmesa.setLibre bMesa
    Set frmTablero.lista = lSalon.getListaMesas(frmTablero.bSalon)
    Unload frmLiberarMesa
End Sub
Public Sub ReservarMesa(bMesa As bMesa)
    Dim bpedido As bpedido
    Dim result As Integer
    Set bpedido = logica.getPedidoPorMesa(bMesa)
    If bpedido Is Nothing Then
        utilMensaje.muestraMensaje errorEncontrado
        Exit Sub
    End If
    result = lPedido.eliminarPedido(bpedido)
    If result = UtilConstantes.OPT_PEDIDO_NO_ELIMINABLE Then
        utilMensaje.muestraMensaje PedidoNoEliminable
        Exit Sub
    End If
    lmesa.setReservada bMesa
    Set frmTablero.lista = lSalon.getListaMesas(frmTablero.bSalon)
    Unload frmReservaMesa
End Sub
Public Function fn_validaCortez() As Boolean
    Dim result As Integer
    result = lmesa.fn_validaCortez
    Select Case result
        Case Is > 0
            fn_validaCortez = False
           utilMensaje.muestraMensaje CerrarMesas
        Case Else
            fn_validaCortez = True
    End Select
End Function
Public Sub setEnCaja(bean As bMesa)
    Dim result As Integer
    result = lmesa.setEnCaja(bean)
End Sub
Public Sub setOcupada(bean As bMesa)
    Dim result As Integer
    result = lmesa.setOcupada(bean)
End Sub
Public Sub setLibre(bean As bMesa)
    Dim result As Integer
    result = lmesa.setLibre(bean)
End Sub
Public Sub setReservada(bean As bMesa)
    Dim result As Integer
    result = lmesa.setReservada(bean)
End Sub
Private Sub Class_Initialize()
Set logica = New lPedido
Set lmesa = New lmesa
Set lPedido = New lPedido
Set lSalon = New lSalon
End Sub
